package com.socialbank.web.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.socialbank.web.bean.Good;
import com.socialbank.web.bean.GoodsRecommend;
import com.socialbank.web.service.RecommendGoodsService;

@Controller
@RequestMapping("/recommend")
public class RecommendGoodsController {
	
	@Autowired
	private RecommendGoodsService recommendGoodsService;
	
	@RequestMapping("/addOrRemove")
	@ResponseBody
	public Integer recommendGoods(HttpServletRequest req , HttpServletResponse resp , @RequestBody GoodsRecommend goodsRecommend){
		System.out.println(goodsRecommend);
		return recommendGoodsService.addRecommendGoods(goodsRecommend);
	}
	
	
	
	
	
	
	@RequestMapping("/find")
	@ResponseBody
	public List<Good> findRecommendGoods(HttpServletRequest req , HttpServletResponse resp  ){
		List<Good> goodsRecommendList =recommendGoodsService.findRecommendGoods();
		return goodsRecommendList;
	}
	
}
